跳到主要内容Skip to main content

怎么给 AI 工具配权限How to Set Permissions for AI Tools

微型指南 · 约 7 分钟Guide · about 7 min · 引用核验 2026-11-03(仅引用链接与日期) · refs checked 2026-11-03 (reference links and dates only)

AI 工具的危险程度,多半由你给它的权限决定。这份指南讲怎么给得刚好够用、又不过头。How dangerous an AI tool is is mostly decided by the permissions you give it. This guide covers granting exactly enough and no more.

怎么做How to

先想它要干什么,再给权限:写代码给代码目录,别顺手给整个家目录。

读和写分开给:能只读完成任务的,就不给写。

划出禁区:密钥文件、账户配置、系统目录,明确不给。

开确认模式:删除、覆盖、对外发送这类操作,让工具先问再动。

定期收权:项目结束、任务换了,把之前开的权限收回来。

用受限模式跑实验:不信任的用法先关在沙箱里试。

Decide the job first, then the permissions: coding work gets the code directory, not your whole home directory.

Grant read and write separately: if the task completes read-only, do not grant write.

Mark off-limits zones: key files, account configs, and system directories are explicitly excluded.

Turn on confirmation mode: deletions, overwrites, and outbound sends must ask before acting.

Reclaim permissions regularly: when a project ends or the task changes, take back what you opened.

Run experiments in restricted mode: try untrusted usage inside a sandbox first.

例子与判断Example and interpretation

以下是教学情境,不是本站运行或实测记录。A teaching scenario, not a measured or executed site test.

整理文件名的练习可先给一个测试目录的读取权限,产出重命名清单后再决定是否允许写入。无需为了列清单,同时开放删除文件、全盘访问和网络发送。For a filename-cleanup exercise, first grant read access to a test directory and request a rename list. Decide about writes afterwards. Listing proposed names does not require deletion, whole-disk or outbound-network access.

出处Sources
  • FileSystem server 为什么强制声明目录(本站档案)Why Filesystem requires declared dirs ↗
  • OpenHands 的受限模式(本站档案)OpenHands Restricted Mode ↗
  • CLI 的权限询问机制(本站档案)CLI permission prompts ↗